<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //创建对象
        //1、大括号
        let obj = {
            name: "HeBaoDan",
            age: 36
        }
        console.log(obj["name"])
        console.log(obj.name)

        //2、new
        let obj1 = new Object()
        obj1.name="GouWang"
        obj1.age=66
        obj1.height=188
        console.log(obj1.name)

        obj1.introduce=function(name){
            console.log("My name is "+ name)
        }
        
        console.log(obj1.introduce(obj1.name))

        let sayHi=(name)=>{
            return "呢嚎呀~"+name
        }
        console.log(sayHi("MaQiDuo"))

        //3、构造函数(ES3及其之前)：本质还是函数
        function Person(name,age,height){
            this.name=name
            this.age=age
            this.height=height
        }
        let p =new Person("LiZi",6,168)
        console.log(p)
        let p1=new Person("MiuMiu",3,200)
        console.log(p1)

        //4、Class(ES6)

        //函数
        function sum(){
            console.log()
        }
    </script>
</body>

</html>